package com.akuma.redmine.entity;

import com.akuma.common.util.JsonUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by akuma on 2016/10/11.
 *
 * @author akuma
 */
public class ProjectQuery {

    private Long id;
    private Parent parent;
    private String name;
    private String status;
    private String identifier;
    private String description;
    private String created_on;
    private String updated_on;
    private Boolean is_public;
    private List<ProjectQuery> children;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Parent getParent() {
        return parent;
    }

    public void setParent(Parent parent) {
        this.parent = parent;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getIdentifier() {
        return identifier;
    }

    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getCreated_on() {
        return created_on;
    }

    public void setCreated_on(String created_on) {
        this.created_on = created_on;
    }

    public String getUpdated_on() {
        return updated_on;
    }

    public void setUpdated_on(String updated_on) {
        this.updated_on = updated_on;
    }

    public Boolean getIs_public() {
        return is_public;
    }

    public void setIs_public(Boolean is_public) {
        this.is_public = is_public;
    }

    public List<ProjectQuery> getChildren() {
        return children;
    }

    public void setChildren(List<ProjectQuery> children) {
        this.children = children;
    }

    /**
     * 添加子项目
     *
     * @param project
     */
    public void addChildren(ProjectQuery project) {
        if (this.children == null) {
            this.children = new ArrayList<ProjectQuery>();
        }
        this.children.add(project);
    }

    public String toString() {
        if (this == null) {
            return "null";
        }
        return JsonUtils.toJSon(this);
    }
}
